<div class="landing">
	<div class="row">
  {% for card in cards|slice:"1:" %}
    <div class="col-md-4 col-sm-6 article card">
      <p class="img-container"><img src="/media/{{ card.image }}" class="img-responsive" height="180" width="300"></p>
      <p class="tag"><a href="#">{{ card.category.title }}</a></p>
      <h4><a href="{{ card.url }}">{{ card.title }}</a></h4>
      <p class="text">{{ card.preview }}</p>
      {% if card.has_button %}
        <a href="{{ card.button_url }}" class="btn btn-square">{{ card.button_text }}</a>
      {% else %}
        <p class="date">3 дня назад</p>
      {% endif %}
    </div>
    {% if forloop.counter|divisibleby:"3" %}
      <div class="col-md-12 hidden-sm hidden-xs"></div>
    {% endif %}
    {% if forloop.counter|divisibleby:"2" %}
      <div class="col-sm-12 hidden-md hidden-lg hidden-xs"></div>
    {% endif %}
    {% if forloop.counter == 6 and not is_json %}
    {% load widget_tweaks %}
      <div class="col-md-12 col-sm-12 col-xs-12 subscribe">
        <form class="form row" method="post" action="{% url 'subscribe' %}">{% csrf_token %}
          <h3>Лучшая рассылка</h3>
          <div class="form-group col-md-8 col-sm-9 col-xs-12">
          {{ form.email|add_class:"form-control input-square" }}
          </div>
          <div class="col-md-2 col-sm-3 form-group">
            <button type="submit" class="btn btn-square">Подписаться</button>
          </div>
          <div class="col-md-9 col-sm-12">
            <p>Мы напишем, как будет что-то интересное, а спамить не будем, даже не просите.</p>
          </div>
        </form>
      </div>
    {% endif %}
  {% endfor %}
  </div>
</div>
{% if is_paginated and is_json %}
<div class="col-md-12 text-center paginator">
  <ul class="pagination">
    {% if cards.has_previous %}
      <li><a href="?page={{ cards.previous_page_number }}">&laquo;</a></li>
    {% else %}
      <li class="disabled"><span>&laquo;</span></li>
    {% endif %}
    {% for page in paginator.page_range %}
      {% if page_obj.number == page %}
        <li class="active"><span>{{ page }} <span class="sr-only">(current)</span></span></li>
      {% else %}
        <li><a href="?page={{ page }}">{{ page }}</a></li>
      {% endif %}
    {% endfor %}
    {% if cards.has_next %}
      <li><a href="?page={{ cards.next_page_number }}">&raquo;</a></li>
    {% else %}
      <li class="disabled"><span>&raquo;</span></li>
    {% endif %}
  </ul>
</div>
{% endif %}